﻿//-----------------------------------------------------------------------------------------------------------
// WBFSSync Project by Omega Frost 
// http://wbfssync.codeplex.com/
//
// WBFSSync is Licensed under the terms of the 
// Microsoft Reciprocal License (Ms-RL)
//-----------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WbfsSync.Controls
{
    //-------------------------------------------------------------------------------------------------------
    //
    //-------------------------------------------------------------------------------------------------------
    public class QuickLink : TreeViewItem
    {
        //---------------------------------------------------------------------------------------------------
        //
        //---------------------------------------------------------------------------------------------------
        static QuickLink()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(QuickLink), 
                new FrameworkPropertyMetadata(typeof(QuickLink)));
        }


        //---------------------------------------------------------------------------------------------------
        //
        //---------------------------------------------------------------------------------------------------
        public static readonly DependencyProperty LevelProperty = DependencyProperty.Register(
            "Layer", typeof(double), typeof(QuickLink));

        public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
            "Icon", typeof(ImageSource), typeof(QuickLink));

        public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
            "Text", typeof(String), typeof(QuickLink));


        //---------------------------------------------------------------------------------------------------
        //
        //---------------------------------------------------------------------------------------------------
        public double Level
        {
            get { return (double)base.GetValue(LevelProperty); }
            set { base.SetValue(LevelProperty, value); }
        }

        public ImageSource Icon
        {
            get { return base.GetValue(IconProperty) as ImageSource; }
            set { base.SetValue(IconProperty, value); }
        }

        public String Text
        {
            get { return (String)base.GetValue(TextProperty); }
            set { base.SetValue(TextProperty, value); }
        }

        public String Link
        {
            get;
            set;
        }


        //---------------------------------------------------------------------------------------------------
        //
        //---------------------------------------------------------------------------------------------------
        public void LoadIconLocal(String local)
        {
            ImageSourceConverter converter = new ImageSourceConverter();
            this.Icon = (ImageSource)converter.ConvertFromString(
                "pack://application:,,,/" + local);
        }
    }
}
